<?php
namespace app\common\controller;
use think\Model;
use think\facade\Db;
use think\facade\Cache;
use think\facade\Request;
use think\facade\Session;
use think\facade\Cookie;

class ApiBase extends Base
{
    protected function initialize()
    {
        parent::initialize();
        // 跨域请求
        header("Access-Control-Allow-Origin: *");
        header("Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS");
        header("Access-Control-Allow-Credentials: True");//表示是否允许发送Cookie
        header("Access-Control-Allow-Headers:  Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With, Token");
        // 获取系统开关状态
        $this->base = Db::table('system')->where(['status'=>1,'pid'=>1])->order('sort','ASC')->column('value','code');
        if(!$this->base['is_closed']) $this->result('',400,$this->base['close_comment']);
    }
}
